response = Map();
msg = message.get("text");
if(operation.equals("chat") || operation.equals("message"))
{
	//message handler blocks for Need support starts here
	if(msg.equalsIgnoreCase("Need support"))
	{
		response.put("action","reply");
		response.put("replies",{"How can we assisit you?"});
		response.put("input",{"type":"select","options":{"Raise a ticket","Check my ticket status"}});
	}
	//Need support block - Raise a ticket or Check ticket status
	else if(msg.equalsIgnoreCase("Raise a ticket") || msg.equalsIgnoreCase("Check my ticket status"))
	{
		email = {"name":"email","replies":{"Your email id ?"}};
		ticketDetails = Collection();
		// Need support --> Raise a ticket
		if(msg.equalsIgnoreCase("Raise a ticket"))
		{
			response.put("action","context");
			response.put("context_id","createticket");
			name = {"name":"name","replies":{"We will need few basic details of yours to raise a ticket","To start with, Your name please ?"}};
			issue = {"name":"issue","replies":{"Please tell us about your problem"}};
			ticketDetails.insert(name);
			ticketDetails.insert(email);
			ticketDetails.insert(issue);
		}
		// Need support --> check ticket status
		else if(msg.equalsIgnoreCase("Check my ticket status"))
		{
			response.put("action","context");
			response.put("context_id","checkticket");
			Request_id = {"name":"requestId","replies":{"Your Request Id please ?"}};
			ticketDetails.insert(email);
			ticketDetails.insert(Request_id);
		}
		response.put("questions",ticketDetails);
	}
	//message handler blocks for Need support ends here
	else if(msg.equalsIgnoreCase("Just browsing"))
	{
		response.put("action","context");
		response.put("context_id","getnotified");
		getnotified = {"name":"getnotified","replies":{"Great. Take a look around. Let me know if you need anything.I'll be right here to help you","By the way, do you want to get notified about our latest products and upgrades?"},"input":{"type":"select","options":{"Yes","No thanks"}}};
		response.put("questions",{getnotified});
	}
	//message handler blocks for Just browsing ends here
	else if(msg.equalsIgnoreCase("Buy a product"))
	{
		response.put("action","reply");
		response.put("replies",{"Awesome","Would you like to schedule a call with our representative ?","I'm sure they can help you with your needs or you can look for a suitable product yourself"});
		response.put("input",{"type":"select","options":{"Search suitable product","Schedule a call"}});
	}
	//Buy product --> Search suitable product
	else if(msg.equalsIgnoreCase("Search suitable product"))
	{
		response.put("action","context");
		response.put("context_id","selectsuitableproduct");
		category = {"name":"category","replies":{"We have an amazing collection of products and I'm sure I can show the right one for your needs.","What kind of product are you looking for?"},"input":{"type":"select","options":{"Design","Fashion","Furniture","Techs","Shoes"}}};
		response.put("questions",{category});
	}
	//Buy product --> Schedule a call
	else if(msg.equalsIgnoreCase("Schedule a call"))
	{
		response.put("action","context");
		response.put("context_id","schedulecall");
		name = {"name":"name","replies":{"I'll need some details to schedule a call. To start with, your name please?"}};
		phone = {"name":"phone","replies":{{"text":"Your Phone number?"}}};
		email = {"name":"email","replies":{{"text":"And your Email ID ?"}}};
		timeSlots = {"type":"date-timeslots","label":"Pick a date and time","tz":"true","slots":{"1/12/2018":{"11:00","12:00","14:00","16:00"},"2/12/2018":{"11:00","12:00","14:00","16:00"},"3/12/2018":{"11:00","12:00","14:00","16:00"},"4/12/2018":{"11:00","12:00","14:00","16:00"}},"skippable":false};
		slotSelected = {"name":"date","replies":{"Please pick a date and time"},"skippable":false,"input":timeSlots};
		userDataForCall = Collection();
		userDataForCall.insert(name);
		userDataForCall.insert(email);
		userDataForCall.insert(phone);
		userDataForCall.insert(slotSelected);
		response.put("questions",userDataForCall);
	}
	else
	{
		response.put("action","reply");
		response.put("replies",{"Hey there. How can I help you?"});
		response.put("input",{"type":"select","options":{"Buy a product","Need support","Just browsing"}});
	}
}
return response;